package com.glsc.ngateway.oaflow.wsclients.wsdl.workflow;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;

@Configuration
public class WsdlConfiguration {

    @Value("${oawebservice.url}")
    private String oawebserviceUrl;

    @Bean
    public Jaxb2Marshaller marshaller() {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setContextPath("com.glsc.ngateway.oaflow.wsclients.wsdl.workflow");
        return marshaller;
    }

    @Bean
    public WsClient workflowClient(Jaxb2Marshaller marshaller) {
        WsClient client = new WsClient();
        client.setDefaultUri(oawebserviceUrl);
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        return client;
    }

    public String getOawebserviceUrl() {
        return oawebserviceUrl;
    }

    public void setOawebserviceUrl(String oawebserviceUrl) {
        this.oawebserviceUrl = oawebserviceUrl;
    }


}
